<?php
require('./model/_connect.php');
$page=$_REQUEST['page'];//页码
$count=$_REQUEST['count'];//一页几条

$offset=($page-1)*$count;//从第几条开始显示

// 书写sql语句
$sql="SELECT*FROM `wq_list` order by `wq_id` desc limit $offset,$count";
// 执行sql语句
$result=mysqli_query($conn,$sql);
// 查询结果要转成php数组
$arr=mysqli_fetch_all($result,MYSQLI_ASSOC);

// 前端要分页，就需要知道总共有多少条数据才能计算总页数
$sql2="SELECT*FROM `wq_list`";
$result2=mysqli_query($conn,$sql2);
$total=mysqli_num_rows($result2);



echo json_encode(array("code"=>1,"data"=>$arr,"total"=>$total));


?>